import request from '../utils/request'

// 获取手机号码
export const getPhoneNumber = (params) => {
  return request({
    url: `/login/getMobile/admin/${params.code}`,
    method: "GET"
  })
}

// 获取用户信息
export const getUserInfo = () => {
  return request({
    url: `/user/getInfo`,
    method: "GET"
  })
}

// 微信登录
export const postWxLogin = (data) => {
  return request({
    url: `/login/weixin`,
    method: "POST",
    data
  })
}

// 获取工作台信息
export const getWorkBenchData = () => {
  return request({
    url: '/workbench/getData',
    method: "GET"
  })
}

// 获取任务列表
export const getTask = () => {
  return request({
    url: '/task/list',
    method: 'get'
  })
}

// 获取我的患教列表
export const getMyTeacherList = (data) => {
  const param = {
    ...data,
    pageNum: 1,
    pageSize: 999
  }
  return request({
    url: '/user/teacher/list',
    method: 'get',
    data: param
  })
}

// 获取我的医生列表
export const getMyDoctorList = (data) => {
  const param = {
    ...data,
    pageNum: 1,
    pageSize: 999
  }
  return request({
    url: '/user/doctor/list',
    method: 'get',
    data: param
  })
}


// 获取任务的统计数据
export const getTaskCount = (data) => {
  return request({
    url: '/task/getData',
    method: 'get',
    data
  })
}

// 获取我的任务列表
export const getTaskList = (data) => {
  return request({
    url: '/task/list',
    method: 'get',
    data
  })
}

// 设置任务已完成
export const setTaskFinish = (data) => {
  return request({
    url: '/task',
    method: 'put',
    data
  })
}

// 患教获取患者列表
export const getPatientByTeacher = (data) => {
  const param = {
    ...data,
    pageNum: 1,
    pageSize: 999
  }
  return request({
    url: '/patient/list_by_teacher',
    method: 'get',
    data: param
  })
}

// 医生获取患者列表
export const getPatientByDoctor = (data) => {
  const param = {
    ...data,
    pageNum: 1,
    pageSize: 999
  }
  return request({
    url: '/patient/list_by_doctor',
    method: 'get',
    data: param
  })
}

// 根据患者ID获取病程记录列表
export const getDieaseList = (data) => {
  return request({
    url: '/patient/disease/list',
    method: 'get',
    data
  })
}


// 删除任务
export const delTasks = (taskIds) => {
  return request({
    url: `/task/${taskIds}`,
    method: 'delete',
    data: {
      taskIds
    }
  })
}

// 新增任务
export const addTasks = (data) => {
  return request({
    url: '/task',
    method: 'post',
    data: data
  })
}

// 编辑任务
export const editTasks = (data) => {
  return request({
    url: '/task',
    method: 'put',
    data
  })
}

// 根据用户Id获取详细信息
export const getUserInfoById = (userId) => {
  return request({
    url: `/user/${userId}`,
    method: 'get'
  })
}

// 病程记录
export const getRecordsById = (id) => {
  return request({
    url: '/patient/disease/list',
    method: 'get',
    data: {
      userId: id
    }
  })
}

// 设置任务已完成
export const setTaskComplete = (data) => {
  return request({
    url: '/task',
    method: 'put',
    data
  })
}

// 设置重点关注
export const setPayAttention = (data) => {
  return request({
    url: '/patient/setting',
    method: 'put',
    data
  })
}

// 获取任务列表
export const getArticleList = (data) => {
  const param = {
    ...data,
    pageNum: 1,
    pageSize: 999
  }
  return request({
    url: '/article/list',
    method: 'get',
    data: param
  })
}

// 新增文章
export const addArticle = (data) => {
  return request({
    url: '/article',
    method: 'post',
    data
  })
}

// 修改文章
export const editArticle = (data) => {
  return request({
    url: '/article',
    method: 'put',
    data
  })
}

// 批量删除文章
export const deleteArticle = (articleIds) => {
  return request({
    url: `/article/${articleIds}`,
    method: 'delete'
  })
}

// 获取文章详情
export const getArticleInfo = (articleId) => {
  return request({
    url: `/article/${articleId}`,
    method: 'get'
  })
}

// 编辑患者
export const editPatient = (data) => {
  return request({
    url: '/patient/edit',
    method: 'put',
    data
  })
}

